home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Text / Extension Dev. Kit / Extension Sources / Interfaces / ExternalInterface.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-09  |  3.9 KB  |  197 lines  |  [TEXT/KAHL]

  1. #include "ExternalInterface.h"
  2.  
  3. static ExternalCallbackBlock *callbacks;
  4.  
  5. pascal void PrepareCallbacks(ExternalCallbackBlock *call_backs)
  6. {
  7.     callbacks = call_backs;
  8. }
  9.  
  10. pascal    Handle     GetWindowContents(WindowPtr w)
  11. {
  12.     return callbacks->GetWindowContents(w);
  13. }
  14.  
  15. pascal    void    GetSelection(long *selStart, long *selEnd, long *firstChar)
  16. {
  17.     callbacks->GetSelection(selStart, selEnd, firstChar);
  18. }
  19.  
  20. pascal    void    SetSelection(long selStart, long selEnd, long firstChar)
  21. {
  22.     callbacks->SetSelection(selStart, selEnd, firstChar);
  23. }
  24.  
  25. pascal    void    GetDocInfo(WindowPtr w, Str255 fName, short *vRefNum, long *dirID)
  26. {
  27.     callbacks->GetDocInfo(w, fName, vRefNum, dirID);
  28. }
  29.  
  30. pascal    long    GetModDate(WindowPtr w)
  31. {
  32.     return callbacks->GetModDate(w);
  33. }
  34.  
  35. pascal    Handle    CopyText(void)
  36. {
  37.     return callbacks->Copy();
  38. }
  39.  
  40. pascal    void    PasteText(Handle pasteText)
  41. {
  42.     callbacks->Paste(pasteText);
  43. }
  44.  
  45. pascal    long        GetLastLine(void)
  46. {
  47.     return callbacks->GetLastLine();
  48. }
  49.  
  50. pascal    long        GetLineNumber(long selection)
  51. {
  52.     return callbacks->GetLineNumber(selection);
  53. }
  54.  
  55. pascal    long        GetLineStart(long selection)
  56. {
  57.     return callbacks->GetLineStart(selection);
  58. }
  59.  
  60. pascal    long        GetLineEnd(long selection)
  61. {
  62.     return callbacks->GetLineEnd(selection);
  63. }
  64.  
  65. pascal    long        GetLinePos(long line)
  66. {
  67.     return callbacks->GetLinePos(line);
  68. }
  69.  
  70.     
  71. pascal    void        InsertText(char *text, long len)
  72. {
  73.     callbacks->Insert(text, len);
  74. }
  75.  
  76. pascal    void        DeleteText(void)
  77. {
  78.     callbacks->Delete();
  79. }
  80.  
  81.     
  82.     /*    Getting and Setting window text */
  83. pascal    void        SetWindowContents(WindowPtr w, Handle h)
  84. {
  85.     callbacks->SetWindowContents(w, h);
  86. }
  87.  
  88. pascal    void        ContentsChanged(WindowPtr w)
  89. {
  90.     callbacks->ContentsChanged(w);
  91. }
  92.  
  93.     
  94.     /*    Reading file text */
  95. pascal    Handle        GetFileText(short vRefNum, long dirID, Str255 fName, Boolean *canDispose)
  96. {
  97.     return callbacks->GetFileText(vRefNum, dirID, fName, canDispose);
  98. }
  99.  
  100.  
  101.     /*    Direct user-interface calls */
  102. pascal    Boolean        GetFolder(Str255 prompt, short *vRefNum, long *dirID)
  103. {
  104.     return callbacks->GetFolder(prompt, vRefNum, dirID);
  105. }
  106.  
  107. pascal    Boolean        OpenSeveral(Boolean sort, short *file_count, StandardFileReply ***files)
  108. {
  109.     return callbacks->OpenSeveral(sort, file_count, files);
  110. }
  111.  
  112.     
  113. pascal    DialogPtr    CenterDialog(short dialogID)
  114. {
  115.     return callbacks->CenterDialog(dialogID);
  116. }
  117.  
  118. pascal    Boolean        StandardFilter(DialogPtr d, EventRecord *event, short *item)
  119. {
  120.     return callbacks->StandardFilter(d, event, item);
  121. }
  122.  
  123. pascal    void        FrameDialogItem(DialogPtr d, short item)
  124. {
  125.     callbacks->FrameDialogItem(d, item);
  126. }
  127.  
  128.     
  129. pascal    WindowPtr    NewDocument(void)
  130. {
  131.     return callbacks->NewDocument();
  132. }
  133.  
  134. pascal    WindowPtr    OpenDocument(void)
  135. {
  136.     return callbacks->OpenDocument();
  137. }
  138.  
  139.  
  140.     /*    Utility Routines */
  141. pascal    Handle        AllocateMemory(long size, Boolean clear)
  142. {
  143.     return callbacks->Allocate(size, clear);
  144. }
  145.  
  146. pascal    long        FindPattern(char *text, long text_len, long text_offset, 
  147.                                         char *pat, long pat_len,
  148.                                         Boolean case_sensitive)
  149. {
  150.     return callbacks->FindPattern(text, text_len, text_offset, pat, pat_len, case_sensitive);
  151. }
  152.  
  153.     
  154. pascal    void        ReportOSError(short code)
  155. {
  156.     callbacks->ReportOSError(code);
  157. }
  158.  
  159.     
  160.     /*    Preference routines */
  161. pascal    void        GetPreference(ResType prefType, short req_len, void *buffer, short *act_len)
  162. {
  163.     callbacks->GetPreference(prefType, req_len, buffer, act_len);
  164. }
  165.  
  166. pascal    void        SetPreference(ResType prefType, short req_len, void *buffer, short *act_len)
  167. {
  168.     callbacks->SetPreference(prefType, req_len, buffer, act_len);
  169. }
  170.  
  171.  
  172.     /*    Progress routines */
  173. pascal    void        StartProgress(Str255 str, long total, Boolean cancel_allowed)
  174. {
  175.     callbacks->StartProgress(str, total, cancel_allowed);
  176. }
  177.  
  178. pascal    Boolean        DoProgress(long done)
  179. {
  180.     return callbacks->DoProgress(done);
  181. }
  182.  
  183. pascal    void        DoneProgress(void)
  184. {
  185.     callbacks->DoneProgress();
  186. }
  187.  
  188. pascal    Boolean        GetProjectList(FSSpec *spec, short *kind, short *count, ProjectEntry ***entries)
  189. {
  190.     return callbacks->GetProjectList(spec, kind, count, entries);
  191. }
  192.  
  193. pascal    Boolean        ProjectTextList(FSSpec *spec, Handle *text)
  194. {
  195.     return callbacks->ProjectTextList(spec, text);
  196. }
  197.